home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
MOUSE
/
WIMPEYES
/
!WimpEyes
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1995-10-18
|
5KB
|
198 lines
Wimp eyes
"Wimp_CloseDown",taskhandle,&4b534154:
c 260: b=c+4
"Wimp_Initialise",200,&4b534154,"Wimp Eyes"
,taskhandle
-c!0=windowhandle:
"Wimp_OpenWindow",,c
quit%=
"Wimp_Poll",%10000001100100110000,b
reason%
reason%
redraw
.
"Wimp_CloseWindow",,b: quit%=
mouseclick
17,18:
usermessage
quit%
"Wimp_CloseDown",taskhandle,&4b534154
mxnew%,mynew%,button: mxnew%-=x%: mynew%-=y%
(mx%-mxnew%)>4
(my%-mynew%)>4
mx%=mxnew%: my%=mynew%
poiter has moved: get new pupil position
; length=
((mx%-lex%)*(mx%-lex%)+(my%-ley%)*(my%-ley%))
1 lpxnew%=lex%+(erx%-pr%-4)*(mx%-lex%)/length
!1 lpynew%=ley%+(ery%-pr%-4)*(my%-ley%)/length
#; length=
((mx%-rex%)*(mx%-rex%)+(my%-rey%)*(my%-rey%))
$1 rpxnew%=rex%+(erx%-pr%-4)*(mx%-rex%)/length
%1 rpynew%=rey%+(ery%-pr%-4)*(my%-rey%)/length
get left redraw rectangle
lpxnew%<lpx%
)+ lminx%=lpxnew%-pr%: lmaxx%=lpx%+pr%
+. lminx%=lpx%-pr%: lmaxx%=lpxnew%+pr%
lpynew%<lpy%
.+ lminy%=lpynew%-pr%: lmaxy%=lpy%+pr%
0. lminy%=lpy%-pr%: lmaxy%=lpynew%+pr%
get right redraw rectangle
rpxnew%<rpx%
5+ rminx%=rpxnew%-pr%: rmaxx%=rpx%+pr%
7. rminx%=rpx%-pr%: rmaxx%=rpxnew%+pr%
rpynew%<rpy%
:+ rminy%=rpynew%-pr%: rmaxy%=rpy%+pr%
<. rminy%=rpy%-pr%: rmaxy%=rpynew%+pr%
redraw left rectangle
b!0=windowhandle
A% b!04=lminx%-2: b!08=lminy%-h%-2
B% b!12=lmaxx%+2: b!16=lmaxy%-h%+4
"Wimp_UpdateWindow",,b
notready%
notready%
"Wimp_SetColour",0
G!
lpx%+x%,lpy%+y%,pr%
"Wimp_SetColour",7
I'
lpxnew%+x%,lpynew%+y%,pr%
J-
"Wimp_GetRectangle",,b
notready%
redraw right rectangle
b!0=windowhandle
O% b!04=rminx%-2: b!08=rminy%-h%-2
P% b!12=rmaxx%+2: b!16=rmaxy%-h%+4
"Wimp_UpdateWindow",,b
notready%
notready%
"Wimp_SetColour",0
U"
rpx%+x%,rpy%+y%,pr%:
"Wimp_SetColour",7
W'
rpxnew%+x%,rpynew%+y%,pr%
X-
"Wimp_GetRectangle",,b
notready%
[ lpx%=lpxnew%: lpy%=lpynew%
\ rpx%=rpxnew%: rpy%=rpynew%
redraw
"Wimp_RedrawWindow",,b
notready%
x%=b!4: y%=b!8
notready%
b!28<(b!4+b!12)/2
"Wimp_SetColour",0
g'
lex%+x%,ley%+y%,erx%,ery%
"Wimp_SetColour",7
i!
lpx%+x%,lpy%+y%,pr%
b!36>(b!4+b!12)/2
"Wimp_SetColour",0
m.
rex%+x%,rey%+y%,erx%,ery%
"Wimp_SetColour",7
o!
rpx%+x%,rpy%+y%,pr%
"Wimp_GetRectangle",,b
notready%
"Wimp_OpenWindow",,b
x%=b!4: y%=b!8
mouseclick
user drags
b!8=64
b!8=16
b!0=windowhandle: b!4=1
"Wimp_DragBox",,b
user quits (with MENU)
b!8=2
quit%=
usermessage
b!16=0
quit%=
flicker%
"OS_ReadModeVariable",-1,4
,,xfak%
"OS_ReadModeVariable",-1,5
,,yfak%
5w%=81<<xfak%: h%=w%/1.8:
window width and hight
colour%=13:
dark green
flicker%=
read commandline
"OS_GetEnv"
CmndLine
<c$="":
: c$=c$+
(?CmndLine): CmndLine+=1:
?CmndLine<32
get width and hight
c$,"-width"):
ww>0
c$,ww+6)): h%=w%/1.8
c$,"-hight"):
hh>0
c$,hh+6))
get colour from comandline
c$,"-colour"):
cc>0
colour%=
c$,cc+7))
get flicker flag
c$,"-flicker")>0
flicker%=
get title bar flag
c$,"-title")>0
tflag%=7<<25
tflag%=0
get -xpos and -ypos OR
set them to the middle of the screen
(x%,y%) is left bottom corner of WimpEye window
c$,"-xpos")
xx>0
x%=
c$,xx+5))
"OS_ReadModeVariable",-1,11
,,x%: x%=((x%<<xfak%)-w%)/2
c$,"-ypos")
yy>0
y%=
c$,yy+5))
"OS_ReadModeVariable",-1,12
,,y%: y%=((y%<<yfak%)-h%)/2
7lex%=w%/4: ley%=h%/2:
position of left eye centre
:rex%=3*w%/4: rey%=h%/2:
position of right eye centre
Zlpx%=w%/4: lpy%=h%/2: rpx%=0.75*w%: rpy%=h%/2:
position of the center of both pupils
)mx%=0: my%=0:
actual mouse position
$pr%=w%/9:
radius of the pupils
/erx%=w%/5: ery%=h%/2.2:
radii of the eyes
window data
b!00=x%: b!04=y%
)b!08=x%+w%: b!12=y%+h%:
2 1
3b!16=0: b!20=0:
54321098765432109876543210
>b!24=-1: b!28=%10000000000000000000000001000010
tflag%
1b?32=7: b?33=2: b?34=7: b?35=colour%
+b?36=3: b?37=1: b?38=12: b?39=0
b!40=0 : b!44=-h%
b!48=w%: b!52=0
b!56=25: b!64=1
%b!60=%1010000000000000: b!68=0
$(b+72)="Eyes"
b!84=0: b!88=0
"Wimp_CreateWindow",,b
windowhandle